package cn.edu.seu.ssny.dao;

import cn.edu.seu.ssny.dao.support.IBaseDao;
import cn.edu.seu.ssny.entity.Device;
import cn.edu.seu.ssny.entity.StatisticsPowercostRateConfig;
import cn.edu.seu.ssny.entity.StatisticsPowercostRateType;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface IStatisticsPowercostRateConfigDao extends IBaseDao<StatisticsPowercostRateConfig, Integer> {

    List<StatisticsPowercostRateConfig> findStatisticsPowercostRateConfigsByStatisticsPowercostRateType(StatisticsPowercostRateType statisticsPowercostRateType);

    StatisticsPowercostRateConfig findStatisticsPowercostRateConfigByStatisticsPowercostRateTypeAndDevice(StatisticsPowercostRateType statisticsPowercostRateType, Device device);

    @Query(value = "select device_id from tb_statistics_powercost_rate_config where statistics_powercost_rate_type_id=?1", nativeQuery = true)
    List<Integer> findDeviceIdsByStatisticsPowercostRateTypeId(Integer statisticsPowercostRateTypeId);
}
